package java8;


/**
 * Created by richard on 5/18/14.
 */
public class LambdaExpression {

    public static void main(String[] args){
        Person person = new Person();
        Person person1 = new Person();
        LambdaExpression lambdaExpression = new LambdaExpression();
        //Because a functional interface contains only one abstract method,
        // you can omit the name of that method when you implement it.
        // To do this, instead of using an anonymous class expression, you use a lambda expression,
        // which is highlighted in the following method invocation
        lambdaExpression.printPerson(person,(Person person2)-> person2.getAge().equals(1));
    }

    public void printPerson(Person p, CheckPerson c ){
        p.getAge();
        c.test(p);
    }
}

interface CheckPerson{
    public boolean test(Person person);
}
class Person{
    private String name;
    private String age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }
}
